<script>
// #ifdef H5
import wechatAuth from '@/utils/wechatAuth.js'
// #endif

export default {
  onLaunch: function() {
    console.log('App Launch')
    // 获取状态栏高度并设置为全局 CSS 变量 - 使用新的 API
    const windowInfo = uni.getWindowInfo()
    const statusBarHeight = windowInfo.statusBarHeight || 0
    // 通过设置页面根元素的样式来设置 CSS 变量
    this.globalData = {
      statusBarHeight: statusBarHeight
    }
    
    // #ifdef H5
    // H5端：处理微信授权回调
    // this.handleWechatAuthCallback()
    // #endif
  },
  
  // #ifdef H5
  // // 处理微信授权回调
  // handleWechatAuthCallback() {
  //   // 检查URL中是否有授权code
  //   const code = wechatAuth.getCodeFromUrl()
  //   if (code) {
  //     console.log('检测到微信授权回调，code:', code)
  //     // 如果有code，说明是从微信授权页面回调回来的
  //     // 登录页面会处理这个code，这里只做日志记录
  //   }
  // },
  // #endif
  onShow: function() {
    console.log('App Show')
  },
  onHide: function() {
    console.log('App Hide')
  },
  globalData: {
    statusBarHeight: 0
  }
}
</script>

<style>
/*每个页面公共css */
page {
  background-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  --status-bar-height: 0px;
}

.container {
  padding: 0 30rpx;
}

.card {
  background: #fff;
  border-radius: 20rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}

.text-primary {
  color: #4A90E2;
}

.text-success {
  color: #07C160;
}

.text-warning {
  color: #FF9800;
}

.text-danger {
  color: #FF5722;
}

.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-center {
  justify-content: center;
  align-items: center;
}

.flex-between {
  justify-content: space-between;
}

.flex-around {
  justify-content: space-around;
}

.flex-wrap {
  flex-wrap: wrap;
}
</style>

